package com.hjh.pro.exportdb.controller;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.hjh.pro.exportdb.constant.ExportBean;
import com.hjh.pro.exportdb.constant.ExportProperties;
import com.hjh.pro.exportdb.entity.Student;
import com.hjh.pro.exportdb.services.StudentService;
import com.hjh.pro.exportdb.services.TableEntityService;
import com.hjh.pro.exportdb.util.Result;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/test2")
public class TestController2 {

    protected final static Logger logger = LoggerFactory.getLogger(TestController2.class);

    @Autowired
    private ExportProperties exportProperties;

    @Autowired
    private TableEntityService tableSerivce;


    @GetMapping("/demo1")
    public Result test1() {
        logger.info("test22222222222");

        List<ExportBean> tt = exportProperties.getList();
        tt.stream().forEach(aa -> {
            System.out.println(aa.getTableName() + "|" + aa.getCondition() + "|");
        });


        List<Map> tabList = tableSerivce.queryByTable("sys_dict");
        System.out.println("============>>>");


        Result result = new Result();
        result.setData(tt);
        return result;
    }


    @GetMapping("/demo2")
    public Result test2() {
        logger.info("tableSerivce.exportSql.........");

        tableSerivce.exportSql();


        Result result = new Result();
        result.setData("succ");
        return result;
    }


}
